﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TestSystem.Domain.Abstract;
using TestSystem.Domain.DAL;
using TestSystem.Domain.Entities.Authorisation;

namespace TestSystem.Domain.Repositories
{
    public class AccountRepository : IAccountRepository
    {
        private TestSystemContext dbContext = new TestSystemContext();

        public IQueryable<User> Users { get { return dbContext.Users; } }

        public IQueryable<Role> Roles
        {
            get { return dbContext.Roles; }
        }

        public void AddUser(User user)
        {
            dbContext.Users.Add(user);
            dbContext.SaveChanges();
        }

        public void RemoveUser(User user)
        {
            dbContext.Users.Remove(user);
            dbContext.SaveChanges();
        }
    }
}
